﻿namespace DataGeneration.Domain.Helpers
{
    /// <summary>
    /// Defines the type ApplicationSettings
    /// </summary>
    public static class ParameterizedAppSettings
    {
        /// <summary>
        /// Gets or sets the type of the database.
        /// </summary>
        /// <value>The type of the database.</value>
        public static SupportedDatabase DatabaseType { get; set; }
        /// <summary>
        /// Gets the sequence data file.
        /// </summary>
        /// <value>The sequence data file.</value>
        public static string SequenceDataFile { get; set; }
        /// <summary>
        /// Gets the entities filename.
        /// </summary>
        /// <value>The entities filename.</value>
        public static string EntitiesFilename { get; set; }
        /// <summary>
        /// Gets the data load scripts folder.
        /// </summary>
        /// <value>The data load scripts folder.</value>
        public static string DataLoadScriptsFolder { get; set; }
        /// <summary>
        /// Gets the database connection string.
        /// </summary>
        /// <value>The database connection string.</value>
        public static string DatabaseConnectionString { get; set; }
        public static bool SilentMode { get; set; }

        /// <summary>
        /// Generates the entity SQL filename.
        /// </summary>
        /// <param name="patternName">Name of the pattern.</param>
        /// <param name="entityName">Name of the entity.</param>
        /// <returns></returns>
        public static string GenerateEntitySqlFilename(string patternName, string entityName)
        {
            return string.Format(@"{0}{1}\SQL\{2}.sql", DataLoadScriptsFolder, patternName, entityName);
        }
        /// <summary>
        /// Generates the entity key filename.
        /// </summary>
        /// <param name="patternName">Name of the pattern.</param>
        /// <param name="entityTableName">Name of the entity table.</param>
        /// <returns></returns>
        public static string GenerateEntityKeyFilename(string patternName, string entityTableName)
        {
            return string.Format(@"{0}{1}\Keys\{2}.key", DataLoadScriptsFolder, patternName, entityTableName);
        }
        
        /// <summary>
        /// Generates the batch filename.
        /// </summary>
        /// <param name="patternName">Name of the pattern.</param>
        /// <param name="batchNo">The batch no.</param>
        /// <returns></returns>
        public static string GenerateBatchFilename(string patternName,int batchNo)
        {
            return string.Format(@"{0}{1}\SQL\{2}.sql", DataLoadScriptsFolder, patternName, batchNo);
        }

        /// <summary>
        /// Generates the patter filename.
        /// </summary>
        /// <param name="patternName">Name of the pattern.</param>
        /// <returns></returns>
        public static string GeneratePatterFilename(string patternName)
        {
            return string.Format(@"{0}{1}.xml", DataLoadScriptsFolder, patternName);
        }

        /// <summary>
        /// Generates the entity CSV filename.
        /// </summary>
        /// <param name="patternName">Name of the pattern.</param>
        /// <param name="entityName">Name of the entity.</param>
        /// <returns></returns>
        public static string GenerateEntityCsvFilename(string patternName, string entityName)
        {
            return string.Format(@"{0}{1}\CSV\{2}.csv", DataLoadScriptsFolder, patternName, entityName);
        }
        
    }
}


